package com.zz.comframe;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import com.zz.comframe.properties.PropertiesPool;

public class test {

	/**
	 * @param args

	public static void main(String[] args) {
		String sql = "select limit " + "0" + " " + "15" + " * from student";
		// List result = new ArrayList();
		String str = "";
		try {

			Connection conn = DbUtils.getConn();
			Statement state = conn.createStatement();

			ResultSet rs = state.executeQuery("select count(*) from student");
			int totalCount = 0;
			if (rs.next()) {
				totalCount = rs.getInt(1);
			}

			rs = state.executeQuery(sql);
			ResultSetMetaData rsm = rs.getMetaData();

			while (rs.next()) {
				str += "{";
				for (int i = 1; i <= rsm.getColumnCount(); i++) {
					str += rsm.getColumnName(i) + ":";
					str += rs.getObject(i) + ",";
					str += "type:" + rsm.getColumnClassName(i)+",";
				}
				str = str.substring(0, str.lastIndexOf(','))+"},";
			}
			DbUtils.close(rs, state, conn);
		} catch (Exception ex) {
			System.err.println(ex);
		}
		str = str.substring(0, str.lastIndexOf(','));
		
		System.out.print(str);
	}
	 */
	@SuppressWarnings("unchecked") 
	public static void main(String[] args) {
		String sql = "select * from student";// gridheader";
		Date d1 = new Date();
		CommonDataProcesser dp = new CommonDataProcesser();
		/*//'1','2002015','张光和',1,21,'团员','湖北省','物流工程学院','1990-2-3'
		//dp.insert("insert into student values(?,?,?,?,?,?,?,?)", Constants.getUUidstr(),"2012001",
		Object[] obj = {Constants.getUUidstr(),"2012001","007",1,38,"tian","js","hwai"};
		String[] cols = {"col0","col2","col3","col4","col5","col6","col7","col8"};
		//dp.insert(Constants.SQL_INST_STUDENT, Constants.getUUidstr(),"2012001",	"007", 1, 38, "tuan", "js", "hwai");
		dp.insert(Constants.SQL_INST_STUDENT,cols,obj );*/

		Page p = dp.PageQuery(PropertiesPool.getCommonpro("SQL_SELECT_PERINFO"), 0,15,null,null);
		//sql = Constants.getSQL_SELECT_GRIDHEADER(null);			//获得gridheaders

		//p.setGridheader(dp.getObjectListAll(sql));
	    //String str = p.getcolumModle();
	    //str = str.replaceFirst("data:","'action':true,'message':'error!','data':");
		System.out.println(p.PrintJSONString());
		/*for (int i = 0; i < list.size(); i++) {
			List<Map<String, String>> l = list.get(i);
			// System.out.print("INSERT INTO STUDENT VALUES(");
			String str = "";
			for (int k = 0; k < l.size(); k++) {
				Set<Map.Entry<String, String>> mapset = l.get(k).entrySet();
				Map.Entry<String, String> m = (Entry<String, String>) mapset
						.toArray()[0];
				System.out.print(m.getKey() + ":" + m.getValue() + "  ");
				// str += "'"+m.getValue() + "',";
			}
			 
			System.out.println();
		}*/
		//System.out.println(java.util.UUID.randomUUID());
		String s = "123asdqwe__123  rew-trafgds";
		//"[a-z]*[A-Z]*\\d*-*_*\\s*"    包含“-“和”-“和a-z，A-Z，0-9的表达式
		System.out.println("原来: "+s);
		s =s.replaceAll("[a-z]*[A-Z]*\\d*\\s*", "");	//若无特殊字符，则被全部替换
		System.out.println("替换后: "+s);
		 
		Date d2 = new Date();
		System.out.println(d2.getTime() - d1.getTime());
	}

}
